package net.lanelife.casino.caipiao.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Index;
import javax.persistence.Table;

import net.lanelife.casino.common.entity.annotation.Checked;
import net.lanelife.casino.common.entity.support.CheckableEntity;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

/**
 * 开奖号码
 * 
 * @author Lane
 *
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "TB_LOTTERY_NUMBER", indexes = { 
	@Index(name = "IDX_GAME_ID", columnList = "GAME_ID"),
	@Index(name = "IDX_GAME_NAME", columnList = "GAME_NAME"),
	@Index(name = "IDX_ISSUE", columnList = "ISSUE"),
	@Index(name = "IDX_LOTTERY_TIME", columnList = "LOTTERY_TIME"),
	@Index(name = "IDX_STATUS", columnList = "STATUS")
})
public class LotteryNumber extends CheckableEntity<Integer> {

	private static final long serialVersionUID = 3138154811882771732L;

	/**
	 * 彩种ID
	 */
	@Checked
	@Column(name = "GAME_ID", nullable = false)
	private Integer gameId;

	/**
	 * 彩种名称
	 */
	@Checked
	@Column(name = "GAME_NAME", length = 10, nullable = false)
	private String gameName;

	/**
	 * 期号
	 */
	@Checked
	@Column(name = "ISSUE", length = 15, nullable = false)
	private String issue;

	/**
	 * 开奖时间
	 */
	@Column(name = "LOTTERY_TIME")
	@Type(type = "net.lanelife.casino.common.entity.usertype.PersistentDateTimeAsMillisLong")
	private DateTime lotteryTime;

	/**
	 * 开奖号码
	 */
	@Checked
	@Column(name = "LOTTERY_NUMBER", length = 100, nullable = false)
	private String lotteryNumber = "";

	/**
	 * 状态
	 */
	@Checked
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "STATUS", nullable = false)
	private Status status = LotteryNumber.Status.UNAWARD;

	public static enum Status {
		/**
		 * 未派奖
		 */
		UNAWARD,
		/**
		 * 派奖中
		 */
		AWARDING,
		/**
		 * 派奖中断
		 */
		AWARDFAIL,
		/**
		 * 已派奖
		 */
		AWARDED,
		/**
		 * 撤单中
		 */
		CANCELING,
		/**
		 * 已撤单
		 */
		CANCELLED
	}

	public Integer getGameId() {
		return gameId;
	}

	public void setGameId(Integer gameId) {
		this.gameId = gameId;
	}

	public String getGameName() {
		return gameName;
	}

	public void setGameName(String gameName) {
		this.gameName = gameName;
	}

	public String getIssue() {
		return issue;
	}

	public void setIssue(String issue) {
		this.issue = issue;
	}

	public DateTime getLotteryTime() {
		return lotteryTime;
	}

	public void setLotteryTime(DateTime lotteryTime) {
		this.lotteryTime = lotteryTime;
	}

	public String getLotteryNumber() {
		return lotteryNumber;
	}

	public void setLotteryNumber(String lotteryNumber) {
		this.lotteryNumber = lotteryNumber;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

}
